package com.lh_travel.lohas.animation;
import android.support.v4.view.ViewPager;
import android.view.View;

public class ScaleXPageTransformer implements ViewPager.PageTransformer {

    @Override
    public void transformPage(View view, float position) {
        if (position > -1 && position < 1) {
            float width = view.getWidth()/2;

            if (position == 0) {

               view.setTranslationX(0);

            } else if (position > 0 && position < 1){

                view.setTranslationX(position * width);

            }else if (position > -1 && position < 0){

                view.setTranslationX(-position * width);
            }

        }
    }
}
